﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Reflection;

namespace Summerset.Isbndb.Books
{
    
    /// <summary>
    /// Represents data that represents that that will be used to create a request to the BooksCollection endpoint.
    /// </summary>
    public sealed class BooksRequest : RequestBase
    {
        #region Constructor

        /// <summary>
        /// Initializes a new instance of the BooksRequest.
        /// </summary>
        /// <param name="indexName">The index which will be queried with the search terms.</param>
        /// <param name="searchTerms">The search terms that will be used to query the collection.</param>
        /// <param name="additionalResultFields">Additional details to request from the API.</param>
        public BooksRequest(string indexName, string searchTerms, params string[] additionalResultFields) 
            : base(indexName, searchTerms, additionalResultFields) { }

        #endregion
        #region Overridden Properties

        /// <summary>
        /// Gets the base URI for all requests against this collection.
        /// </summary>
        public override Uri RequestBaseUri
        {
            get { return new Uri("https://isbndb.com/api/books.xml"); }
        }

        /// <summary>
        /// Gets all the valid indexes for this collection.
        /// </summary>
        protected override Func<string[]> GetValidIndexNames 
        { 
            get { return new Func<string[]>(BookArgs.GetValidIndexArguments); } 
        }

        /// <summary>
        /// Gets all the valid additional result fields for this collection.
        /// </summary>
        protected override Func<string[]> GetValidAdditionalResultFields
        { 
            get { return new Func<string[]>(BookArgs.GetValidResultArguments); }
        }

        #endregion
    }

}
